package com.noahsloan.nutils.streams;

import java.io.FileNotFoundException;
import java.io.FilterOutputStream;
import java.io.OutputStream;

import com.noahsloan.nutils.streams.FileOutputStreamSeries.FilenameGenerator;

public class FileChunkingOutputStream extends FilterOutputStream {
	/**
	 * Writes files of the given size (or smaller) with the given basename.
	 * 
	 * @param basename
	 * @param chunkSize
	 * @throws FileNotFoundException
	 */
	public FileChunkingOutputStream(String basename, int chunkSize) {
		super(new ChunkingOutputStream(
				new OutputStream[] { new FileOutputStreamSeries(basename) },
				new int[] { chunkSize }));
	}

	public FileChunkingOutputStream(FilenameGenerator names, int chunkSize) {
		super(new ChunkingOutputStream(
				new OutputStream[] { new FileOutputStreamSeries(names) },
				new int[] { chunkSize }));
	}
}
